import {apiResquest} from './api.js'

/* ------登录注册------ */
// 获取sessionId
export const getSessionId = () => {
  return apiResquest({
    url:'/api/system/getSessionId.open',
    method:'get',
  })
}
// 用户注册
export const userRegister = (options) => {
  return apiResquest({
    url:'/jishan/api/user/register.open.verify?username='+options.username+'&password='+options.password+
	'&verifyCode='+options.verifyCode+'&telephone='+options.telephone+'&name='+options.name,
    method:'post'
  })
}
// 用户登录
export const userLogin = (query) => {
  return apiResquest({
    url:'/jishan/api/user/login.open',
    method:'post',
    query:query
  })
}


// 获取首页信息
export const getHomeInfo = () => {
  return apiResquest({
    url:'/jishan/api/system/selectAll.open',
    method:'get',
  })
}
// 获取公告

export const getNotice = () => {
  return apiResquest({
    url:'/jishan/api/notice/selectAll.open',
    method:'get',
  })
}


/* ------提交申请------ */
export const userApply = (query) => {
  return apiResquest({
    url:'/jishan/api/apply/insert.api',
    method:'post',
    query:query
  })
}


/* ------改造服务------ */
// 获取产品菜单
export const getProductMenu = () => {
  return apiResquest({
    url:'/jishan/api/productMenu/selectAll.open',
    method:'get',
  })
}
// 获取机构介绍菜单
export const getProduct = (id) => {
  return apiResquest({
    url:'/jishan/api/product/selectByProductMenuId.open?productMenuId='+id,
    method:'get',
  })
}
// 获取产品详情
export const getProductDetail = (id) => {
  return apiResquest({
    url:'/jishan/api/product/selectByPrimaryKey.open?primaryKey='+id,
    method:'get',
  })
}

// 获取机构菜单
export const getInstitutionMenu = () => {
  return apiResquest({
    url:'/jishan/api/organizationMenu/selectAll.open',
    method:'get',
  })
}
// 获取机构详情
export const getInstitutionDetail = (id) => {
  return apiResquest({
    url:'/jishan/api/organization/selectByOrganizationMenuId.open?organizationMenuId='+id,
    method:'get',
  })
}

// 获取动态信息
export const getDynamicInfo = () => {
  return apiResquest({
    url:'/jishan/api/news/selectAll.open',
    method:'get',
  })
}
// 获取动态详情
export const getDynamicDetail = (id) => {
  return apiResquest({
    url:'/jishan/api/news/selectByPrimaryKey.open?primaryKey='+id,
    method:'get',
  })
}


/* ------场景选择------ */
// 获取场景菜单
export const getSceneMenu = () => {
  return apiResquest({
    url:'/jishan/api/sceneMenu/selectAll.open',
    method:'get',
  })
}
// 获取场景详情
export const getSceneDetail = (id) => {
  return apiResquest({
    url:'/jishan/api/scene/selectBySceneMenuId.open?sceneMenuId='+id,
    method:'get',
  })
}


// 获取用户申请
export const getUserApply = (id) => {
  return apiResquest({
    url:'/jishan/api/apply/selectByUserId.api?userId='+id,
    method:'get',
  })
}